package com.nl.pulsardemo.pool.config.produce;

import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.pulsar.client.api.PulsarClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author : ZhaoY
 * @description :
 * @date : 2021-02-05 09:45
 **/
@Configuration
public class ProducerPoolConfiguration {
    @Autowired
    private PulsarClient client;

    @Bean
    GenericObjectPool producerPool() {
        return new GenericObjectPool<>(new PooledProducerFactory(client), new MyProducerPoolConfig());
    }
}
